package f_socketChat;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

/**
 * 创建客户端   发送数据+接收数据
 * 写入数据    输出流
 * 读取数据   输入流
 * 
 * 输入流和输入流在同一线程内 彼此独立
 * @author Y
 *
 */
public class Client {

	public static void main(String[] args) throws IOException {
		System.out.println("请输入姓名:");
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String name = br.readLine();
		if (name == null || name.equals("")) {
			return;
		}
		Socket client = new Socket("localhost",9999);
		//一个路径(线程)
		Send send = new Send(client,name);
		new Thread(send).start();
		//一个路径(线程)
		Receive receive = new Receive(client);
		new Thread(receive).start();
		
		
	}
}
